/**
 *
 * @param dom 需要监听的dom
 * @param callback 回调函数
 */
const onResize = (dom: HTMLElement, callback: (e?: any) => void) => {
  const resizeObserver = new ResizeObserver((entries) => {
    const entry = entries[0];
    if (entry.contentRect) {
      const cr = entry.contentRect;
      console.log(cr);
      callback(cr);
    }
  });
  resizeObserver.observe(dom);
};
export default onResize;
